//
//  AY_BookOpinionCell1.m
//  AiYue
//
//  Created by boWen on 2023/11/13.
//

#import "AY_BookOpinionCell1.h"

@interface AY_BookOpinionCell1 ()
@property (nonatomic,strong) UIView * bg_View;//底部圆角
@property (nonatomic,strong) UILabel * articleNameLabel;
@property (nonatomic,strong) UILabel * articleLeadOrAuthorLabel;
@property (nonatomic,strong) UILabel * laiyuanLabel;
@end

@implementation AY_BookOpinionCell1


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self addAllSubviewsWithUI];
    }
    return self;
}


- (void)addAllSubviewsWithUI {
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.contentView.backgroundColor = [UIColor whiteColor];
    
    self.bg_View = [AYTool createViewWithFrame:CGRectZero andBg:[UIColor whiteColor] andRadius:YNUM(6) andAddSubView:self.contentView];
    [self.bg_View mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(YNUM(12));
        make.right.equalTo(self.contentView).offset(YNUM(-12));
        make.height.mas_offset(YNUM(78));
    }];

    self.articleNameLabel = [AYTool createLabelWithFrame:CGRectZero andText:@"书籍名称（必填）" andTextColor:COLOR(@"#000002") andBgColor:nil andFont:[UIFont systemFontOfSize:YNUM(14)] andLines:1 andRadius:0 andAddSubView:self.bg_View];
    [self.articleNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.bg_View);
        make.left.equalTo(self.bg_View);
        make.height.mas_offset(YNUM(22));
    }];
    
    
    UIView * nameView = [AYTool createViewWithFrame:CGRectZero andBg:COLOR(@"#FAFAFA") andRadius:YNUM(6) andAddSubView:self.bg_View];
    [nameView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.articleNameLabel.mas_bottom).offset(YNUM(8));
        make.left.equalTo(self.bg_View);
        make.right.equalTo(self.bg_View);
        make.bottom.equalTo(self.bg_View.mas_bottom);
    }];
    
    self.articleNameField = [[UITextField alloc]init];
    self.articleNameField.placeholder = @"请输入书籍名称";
    self.articleNameField.font = [UIFont systemFontOfSize:YNUM(14)];
    [nameView addSubview:self.articleNameField];
    [self.articleNameField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(nameView).offset(YNUM(16));
        make.right.equalTo(nameView).offset(YNUM(-16));
        make.centerY.equalTo(nameView);
        make.bottom.equalTo(nameView);
    }];
    
    
    UIView * bg_view1 = [AYTool createViewWithFrame:CGRectZero andBg:[UIColor whiteColor] andRadius:YNUM(6) andAddSubView:self.contentView];
    [bg_view1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.bg_View.mas_bottom).offset(YNUM(15));
        make.height.mas_offset(YNUM(78));
        make.left.equalTo(self.contentView).offset(YNUM(12));
        make.right.equalTo(self.contentView).offset(YNUM(-12));
    }];
    self.articleLeadOrAuthorLabel = [AYTool createLabelWithFrame:CGRectZero andText:@"作者/主角（必填）" andTextColor:COLOR(@"#000002") andBgColor:nil andFont:[UIFont systemFontOfSize:YNUM(14)] andLines:1 andRadius:0 andAddSubView:bg_view1];
    [self.articleLeadOrAuthorLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bg_view1);
        make.left.equalTo(bg_view1);
        make.height.mas_offset(YNUM(22));
    }];
    
    
    UIView * nameView1 = [AYTool createViewWithFrame:CGRectZero andBg:COLOR(@"#FAFAFA") andRadius:YNUM(6) andAddSubView:bg_view1];
    [nameView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.articleLeadOrAuthorLabel.mas_bottom).offset(YNUM(8));
        make.left.equalTo(bg_view1);
        make.right.equalTo(bg_view1);
        make.height.mas_offset(YNUM(48));
    }];
    
    self.articleLeadOrAuthorField = [[UITextField alloc]init];
    self.articleLeadOrAuthorField.font = [UIFont systemFontOfSize:YNUM(14)];
    self.articleLeadOrAuthorField.placeholder = @"请输入作者/主角";
    [nameView1 addSubview:self.articleLeadOrAuthorField];
    [self.articleLeadOrAuthorField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(nameView1).offset(YNUM(16));
        make.right.equalTo(nameView1).offset(YNUM(-16));
        make.centerY.equalTo(nameView1);
    }];
    
    UIView * bg_view2 = [AYTool createViewWithFrame:CGRectZero andBg:[UIColor whiteColor] andRadius:YNUM(6) andAddSubView:self.contentView];
    [bg_view2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bg_view1.mas_bottom).offset(YNUM(15));
        make.bottom.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(YNUM(12));
        make.right.equalTo(self.contentView).offset(YNUM(-12));
    }];
    self.laiyuanLabel = [AYTool createLabelWithFrame:CGRectZero andText:@"来源/内容（选填）" andTextColor:COLOR(@"#000002") andBgColor:nil andFont:[UIFont systemFontOfSize:YNUM(14)] andLines:1 andRadius:0 andAddSubView:bg_view2];
    [self.laiyuanLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bg_view2);
        make.left.equalTo(bg_view2);
        make.height.mas_offset(YNUM(22));
    }];
    
    UIView * nameView2 = [AYTool createViewWithFrame:CGRectZero andBg:COLOR(@"#FAFAFA") andRadius:YNUM(6) andAddSubView:bg_view2];
    [nameView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.laiyuanLabel.mas_bottom).offset(YNUM(8));
        make.left.equalTo(bg_view2);
        make.right.equalTo(bg_view2);
        make.height.mas_equalTo(YNUM(100));
    }];
    
    self.laiyuanField = [[UITextView alloc]init];
    self.laiyuanField.font = [UIFont systemFontOfSize:YNUM(14)];
//    self.laiyuanField.placeholder = @"请输入来源地址/或者第一章内容";
    self.laiyuanField.backgroundColor = COLOR(@"#FAFAFA");
    [nameView2 addSubview:self.laiyuanField];
    [self.laiyuanField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(nameView2).offset(YNUM(16));
        make.right.equalTo(nameView2).offset(YNUM(-16));
        make.height.mas_equalTo(YNUM(100));
        
    }];
}

@end
